package day04;

import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        int num = (int)(Math.random() * 1000 + 1);
//        System.out.println(num);
//        System.out.println("请开始猜");
//        int guess = scanner.nextInt();
//        while(guess != num) {
//            if(guess > num) {
//                System.out.println("猜大了，重新猜");
//            }else {
//                System.out.println("猜小了，重新猜");
//            }
//            guess = scanner.nextInt();
//        }
//        System.out.println("恭喜你，猜对了");
        Scanner scanner = new Scanner(System.in);
        int num =(int)(Math.random() * 1000 + 1);
        System.out.println(num);
        System.out.println("开始猜拳");
        int guess;
        do {
            guess = scanner.nextInt();
            if(guess > num) {
                System.out.println("猜大了，重新猜");
            }else if(guess < num) {
                System.out.println("猜小了，重新猜");
            }else {
                System.out.println("恭喜你，猜对了");
            }
        }while (guess != num);
    }
}
